package com.example.hs.Repository;

import com.example.hs.Pojo.Category;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CategoryRepository extends JpaRepository<Category, Integer> {
    // 查询所有一级分类及其包含的二级分类，并支持分页和排序
    @Query("SELECT c FROM Category c WHERE c.parent IS NULL")
    List<Category> findAllFirstLevelCategoriesWithChildren();
}
